package com.zh.controller.app;

import cn.hutool.core.util.IdUtil;
import com.zh.pojo.domain.DriverPoint;
import com.zh.result.JSONResult;
import com.zh.service.IDriverPointService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/app/bigdata")
public class DriverPointController {
    @Autowired
    private IDriverPointService driverPointService;

    @Operation(summary = "保存司机司机行驶坐标", description = "保存司机司机行驶坐标")
    @Parameter(name = "driverPoint", description = "保存的对象", required = true)
    @PostMapping("/driverPoint/saveLocation")
    public JSONResult saveLocation(@RequestBody @Valid DriverPoint driverPoint) {
        // 保存ID
        driverPoint.setId(IdUtil.createSnowflake(1, 1).nextId());
        driverPointService.save(driverPoint);
        return JSONResult.success();
    }
}
